home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 2821 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.9 KB

  1. Path: ludens.elte.hu!genie
  2. From: genie@ludens.elte.hu
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: Removing a patch -A POSSIBLE SOULTION
  5. Message-ID: <1996Feb5.162318.23977@ludens>
  6. Date: 5 Feb 96 16:23:18 +0200
  7. References: <1996Jan29.141204.23597@ludens> <1177.6603T1212T240@stud.cs.uit.no>
  8. Organization: Eotvos University, Budapest, Hungary
  9.  
  10. >>The code for the patch which is SetFunctioned somewhere looks like this:
  11. >>PatchMan:    addq    #1,UseCount    ;how many tasks using this patch?
  12. >             ^^^^^^^^^^^^^^^^^
  13. > This does really not help a lot if you want your progam to be 100% safe. 
  14. > Still, it does decrease the chance of crashes. The problem is that a process
  15. > switch could (at least in teory) occur right after the PC was loaded with the
  16. > address of your routine, but before actually executing the first instruction
  17. > in it.
  18.  
  19. I don't think it's a problem, because the PatchMan routine stays in memory
  20. "forever", which is a really tiny piece of code, but I can safely free up
  21. the memory allocated for the main patch code (to which this PatchMan later
  22. gives control). Suppose the scheduler stops the PathcMan routine just before
  23. it could increase UseCount, and so UseCount stays zero. If in this moment the
  24. patch is removed, it is set inactive, and when PatchMan gets the CPU again,
  25. it won't let the patchcode run. Rescheduling cannot occur while setting the
  26. patch into inactive state due to the Forbid()den state of the removal handler.
  27. Consider this!
  28.  
  29. --------------------------------------------------------------------------------
  30.      ///  Kertai 'Genie' Gabor                     | PGP fingerprint:
  31.     ///   from Eotvos Lorad University of Sciences |   32 36 96 9A 15 61 03 98
  32. \\\///    Budapest 1038, Eszak u. 39., Hungary     |   7D D3 29 14 84 27 78 AC
  33.  \XX/     E-mail: genie@ludens.elte.hu             | Public key via finger...
  34. --------------------------------------------------------------------------------
  35.